package com.itheima.controller;

import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.pojo.Result;
import com.itheima.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 16778
 * @version 1.0
 * @date 2025/9/24 20:36
 */
@Slf4j
@RestController
//@Scope("prototype/singleton")
@RequestMapping("/log")
public class OperateLogController {
    @Autowired
    private OperateLogService logService;

    @GetMapping("/page")
    public Result page(@RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer pageSize){
        log.info("执行日志分页查询:页号{},一页记录数{}",page,pageSize);
        PageResult<OperateLog> pageResult = logService.page(page,pageSize);
        return Result.success(pageResult);
    }
}
